<?php
	
	require_once('./template/header.tpl.php');
	include_once('./src/connect.php');
	include_once('./src/config.php');
	session_start();
	$username = $_SESSION['username'];
	$coursename = $_GET['coursename'];
	$teacher = $_GET['teacher'];
	$campus = $_GET['campus'];
	$building = $_GET['building'];
	$room = $_GET['room'];
	$weekday = $_GET['weekday'];
	$dayfrom = $_GET['dayfrom'];
	$dayto = $_GET['dayto'];

	$query = "INSERT INTO ark_mytable (uid,coursename,teacher,campus,building,room,weekday,dayfrom,dayto) VALUES ('$username', '$coursename', '$teacher', '$campus', '$building', '$room', '$weekday', '$dayfrom', '$dayto')";
	$result = mysql_query($query, $link);

	/*if(!$result){
		print_r(mysql_error());
	}*/

	if (mysql_affected_rows() == 1) {
		session_start();
		$keyword = $_SESSION['keyword'];
		//header("Location: search.php?keyword=$keyword");
		header("Location: student_table.php");
	}
	else {
		$msg == "添加失败";
		echo "<script>alert($msg);windows.history.go(-1);</script>";	
	}
?>